.TH std::ranges::drop_while_view::begin 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::drop_while_view::begin \- std::ranges::drop_while_view::begin

.SH Synopsis
   constexpr auto begin();  \fI(since C++20)\fP

   Returns an iterator to the first element of the view.

   Effectively returns ranges::find_if_not(base_, std::cref(pred())), where base_ is
   the underlying view. The behavior is undefined if *this does not store a predicate.

   In order to provide the amortized constant time complexity required by the range
   concept, this function caches the result within the drop_while_view object for use
   on subsequent calls.

.SH Parameters

   \fI(none)\fP

.SH Return value

   Iterator to the first element of the view.

.SH Example


// Run this code

 #include <array>
 #include <iostream>
 #include <ranges>

 int main()
 {
     constexpr std::array data{ 0, -1, -2, 3, 1, 4, 1, 5 };

     auto view = std::ranges::drop_while_view{
         data, [](int x) { return x <= 0; }
     };

     std::cout << *view.begin() << '\\n';
 }

.SH Output:

 3

.SH See also

   end     returns an iterator or a sentinel to the end
   (C++20) \fI(public member function)\fP
